import axios from '@/libs/api.request'
import qs from 'qs'

export const getTableData = (params) => {
  return axios.request({
    url: 'admins/maintainPlan/page?t='+new Date().getTime(),
    params,
    method: 'get'
  })
}
export const getTableData2 = (params) => {
  return axios.request({
    url: 'admins/maintainPlan/page?t='+new Date().getTime(),
    params,
    method: 'get'
  })
}
export const findById = (params) => {
  return axios.request({
    url: 'admins/maintainPlan/findById?t='+new Date().getTime(),
    params,
    method: 'get'
  })
}

export const findByRepairId = (params) => {
    return axios.request({
      url: 'admins/maintainPlanWork/findByMaintainPlanId?t='+new Date().getTime(),
      params,
      method: 'get'
    })
  }
  export const delRepair = (data) => {
    return axios.request({
      url: 'admins/maintainPlanWork/delete?t='+new Date().getTime(),
      data: qs.stringify(data),
      method: 'post'
    })
  }


export const add = (data) => {
  return axios.request({
    url: 'admins/maintainPlan/addOnce?t='+new Date().getTime(),
    data: qs.stringify(data),
    method: 'post'
  })
}

export const update = (data) => {
  return axios.request({
    url: 'admins/maintainPlan/editOnce?t='+new Date().getTime(),
    data: qs.stringify(data),
    method: 'post'
  })
}

export const del = (data) => {
  return axios.request({
    url: 'admins/maintainPlan/delete?t='+new Date().getTime(),
    data: qs.stringify(data),
    method: 'post'
  })
}
//导出维修计划
export const downExcel = (params) => {
  return axios.request({
    url: 'admins/maintainPlan/download?t='+new Date().getTime(),
    method: 'get',
    responseType: 'blob',
    params
  })
}
